<?php 
	$_SESSION['realpage'] = true;
?>
<!DOCTYPE HTML>
<?php 
//require_once "./class.GeneralServices.php";
//require_once "./class.User.php";
$error = false;
//session_start();
?>
<html>
<head>
<?php require_once "./HtmlIncludes.php";?>

<?php 
//$post = GeneralServices::getService()->getGroupPosts($_SESSION['gid'], 5, 0, $_SESSION['userObj']->uid);
$post = $_SESSION['post'];
?>
<title>Insert title here</title>
</head>
    <body onload="load();">
    <script type="text/javascript">
		function load()
		{
			var ur = window.parent.document.URL;			
			if(ur.substring(ur.length - 15, ur.length) != "Pages/panes.php")
				window.location.replace("./panes.php");
		}
    </script>
    <?php $pid = ltrim($post->pid, "0"); ?>
	    <div id="<?php echo $pid?>POST" class="PostItemFrame">
		    <div class="GroupListItem ui-corner-all" onclick="togglePost('<?php echo $pid?>hidePost'); if($('#<?php echo $pid;?>lastTKBKShown').val() == null) { ShowMoreTKBKS(<?php echo $pid;?>, 5, 0); }" style="cursor: pointer;">Topic:&nbsp;<?php echo $_SESSION['post']->Topic;?><br>Description:&nbsp;<?php echo $_SESSION['post']->Content; ?></div>   	    		    
		    <div id="<?php echo $pid?>showhideContainer">
			    <div id="<?php echo $pid?>showhide" style="cursor: pointer;">
			    	<?php if($_SESSION['relation'] == "O" && $post->Visible == 1) { echo '<span id="'.$pid.'hide" class="ui-state-default ui-corner-all" style="color: red;" onclick="erasePost('.$pid.')"><span id="'.$pid.'erasePost">Hide</span></span>'; }?>
			    	<?php if($_SESSION['relation'] == "O" && $post->Visible == 0){ echo '<span id="'.$pid.'show" class="ui-state-default ui-corner-all" style="color: red;" onclick="showPost('.$pid.')"><span id="'.$pid.'showPost">Show</span></span>'; }?>
			    </div>
		    </div>		    
		    <input type="hidden" id="<?php echo $pid?>PID" value="<?php echo ltrim($post->pid, "0");?>"/>   	    	  		       					
			<div id="<?php echo $pid?>hidePost" style="visibility: hidden; display: none;">
				<div id="<?php echo $pid?>TKBKSdiv" class="TalkBackItemFrame">
				<br>
				
				</div>
				<span id="<?php echo $pid?>showMoreTKBKs" class="GroupListItem ui-corner-all" onclick="if($('#<?php echo $pid;?>lastTKBKShown') != null) { ShowMoreTKBKS(<?php echo $pid;?>, 5, $('#<?php echo $pid;?>lastTKBKShown').val()); } else	{ ShowMoreTKBKS(<?php echo $pid;?>, 5, 0); }" style="cursor: pointer;">Show more...</span>
				<div id="<?php echo $pid?>NoMoreTKBKsError" style="visibility: hidden; display: none; color: red;">There are no more talkbacks!</div>
				<br>
				<?php if($_SESSION['relation'] == "O" || $_SESSION['relation'] == "M") { ?>
				<div id="<?php echo $pid?>publishTKBKDiv" class="PostItemFrame">
					<form action="" method="POST">						
						<span style="vertical-align: top;">Content:
							<textarea cols="16" rows="3" name="<?php echo $pid?>publishTKBKContent" id="<?php echo $pid?>publishTKBKContent" class="text ui-widget-content ui-corner-all"></textarea>
						</span>
						<span id="<?php echo $pid?>publishTKBKButton" class="GroupListItem ui-corner-all" style="vertical-align: super; cursor: pointer;" onclick="PostTKBK(<?php echo $pid?>, $('#<?php echo $pid?>publishTKBKContent').val())">Publish</span>
					</form>					
				</div>				
				<?php }
				//this is the closing bracket of publishTKBK!!?>
			</div>
		</div>
    </body>
</html>
<?php 
	$_SESSION['realpage'] = false;
?>